import axios from './http'

/**
 * 获取列表
 * @param params
 * @returns {AxiosPromise}
 */
export const getList = (params) => {
    return axios({
        url: "v1/system/role/",
        method: "get",
        params
    })
}

/**
 * 获取单条数据
 * @param data
 * @returns {AxiosPromise}
 */
export const getRoleDetail = (id) => {
    return axios({
        url: `v1/system/role/${id}/`,
        method: "get",
    })
}


/**
 * 保存角色
 * @param data
 * @returns {AxiosPromise}
 */
export const saveRole = (data) => {
    return axios({
        url: "v1/system/role/",
        method: "post",
        data
    })
}

/**
 * 修改角色
 * @param data
 * @returns {AxiosPromise}
 */
export const updateRole = (id, data) => {
    return axios({
        url: `v1/system/role/${id}/`,
        method: "put",
        data
    })
}


/**
 * 删除角色
 * @param id
 * @returns {AxiosPromise}
 */
export const delDetail = (id) => {
    return axios(
        {
            url: `v1/system/role/${id}/`,
            method: "delete",
        }
    )
}